package com.xianbeiying.app.ckgl.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;

import com.xianbeiying.app.ckgl.R;

/**
 * 温室种类数据适配
 */
public class GhSpContentdapter extends BaseAdapter{

private Context context;
public GhSpContentdapter(Context context) {
        this.context = context;
        }

    @Override
    public int getCount() {
        return 3;
    }

    @Override
    public Object getItem(int position) {
        return getItem(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            convertView = LayoutInflater.from(context).inflate(R.layout.item_ghsp_content, parent, false);
            holder = new ViewHolder();
            holder.iv_ghspimg=(ImageView) convertView.findViewById(R.id.iv_ghspimg);
            holder.iv_ghsp_chose=(ImageView) convertView.findViewById(R.id.iv_ghsp_chose);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder) convertView.getTag();
        }
        if(position==0){
            holder.iv_ghspimg.setVisibility(View.INVISIBLE);
        }else{
            holder.iv_ghspimg.setVisibility(View.VISIBLE);
        }
        return convertView;
    }

    private class ViewHolder{
        ImageView  iv_ghspimg;
        ImageView  iv_ghsp_chose;
    }
}
